let fs = window.require("fs");
let os = require("os");
let dataPath = `C:/Users/${
  os.userInfo().username
}/AppData/Roaming/easyWebsite/pageData.json`;

function loadPageData() {
  try {
    return fs.readFileSync(dataPath).toString();
  } catch (error) {
    return error;
  }
}

function writePageData(data) {
  try {
    fs.writeFileSync(dataPath, data);
    return 200;
  } catch (error) {
    return error;
  }
}

module.exports = { loadPageData, writePageData };
